var t = getApp(), e = (require("../list/filterCommon.js"), require("../../utils/validate.js"));

Page(Object.assign({
    data: {
        shade: !1,
        subsucc: !1,
        hasError: !1,
        resPhone: "",
        nameError: !1,
        listError: !1,
        builuError: !1,
        isYK: !1,
        city: [],
        region: [],
        street: [],
        selected: 5,
        city_show: !0,
        region_show: !0,
        district_show: !0,
        city_id: "",
        region_id: "",
        district_id: "",
        contact_name: "",
        contact_phone: "",
        buildingName: "",
        city_value: "",
        region_value: "",
        district_value: "",
        bangongtype: 0,
        validate: {},
        form: {},
        btn_disabled: !1,
        cityOptions: "",
        regionOptions: ""
    },
    selectedFun: function(t) {
        var e = t.target.dataset.val;
        this.data.selected == e && (e = -1), this.setData({
            selected: e
        });
    },
    onLoad: function(e) {
        var a = this, i = t.getSecret();
        wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/getcitylist/",
            data: {
                domain: t.globalData.domain,
                currtime: i.currtime,
                sign: i.sign
            },
            success: function(t) {
                var e = t.data;
                a.setData({
                    city: e.data
                });
            }
        });
    },
    goTap: function(e) {
        var a = this, i = e.currentTarget.dataset;
        console.log(i), "" != i && a.setData({
            cityT: !0
        }), i.id != s && a.setData({
            region_value: "",
            district_value: ""
        });
        var s = i.id, n = t.getSecret();
        wx.request({
            url: t.globalData.haozuBase + "/geo/getgeo/",
            data: {
                currtime: n.currtime,
                sign: n.sign,
                method: i.sort,
                id: i.id
            },
            success: function(t) {
                var e = t.data;
                a.setData({
                    street: e,
                    city_show: !0,
                    city_id: i.id,
                    city_value: i.name,
                    selected: 5,
                    cityOptions: s
                });
            }
        });
    },
    regionTap: function(e) {
        var a = this, i = e.currentTarget.dataset;
        i.id != s && a.setData({
            district_value: ""
        });
        var s = i.id, n = t.getSecret();
        wx.request({
            url: t.globalData.haozuBase + "/geo/getgeo/",
            data: {
                currtime: n.currtime,
                sign: n.sign,
                method: i.sort,
                id: i.id
            },
            success: function(t) {
                var e = t.data;
                i.id != s && console.log(222), a.setData({
                    region: e,
                    region_show: !0,
                    region_id: i.id,
                    region_value: i.name,
                    selected: 5
                });
            }
        });
    },
    districtTap: function(t) {
        var e = this;
        console.log(e);
        var a = t.currentTarget.dataset;
        e.setData({
            district_show: !0,
            district_id: a.id,
            district_value: a.name,
            selected: 5
        });
    },
    buttonClick: function(e) {
        var a = this, i = t.getSecret();
        a.getValidate(function(e) {
            e && wx.request({
                url: t.globalData.haozuBase + "/bj/fangyuanweituo/",
                data: {
                    currtime: i.currtime,
                    sign: i.sign,
                    phone: a.data.form.phone,
                    name: a.data.form.name,
                    city_id: a.data.city_id,
                    district_id: a.data.region_id,
                    street_id: a.data.district_id,
                    buildingName: a.data.form.Bname
                },
                dataType: "json",
                header: {
                    "Content-Type": "application/x-www-form-urlencoded"
                },
                method: "POST",
                success: function(t) {
                    1 == t.data && (a.setData({
                        subsucc: !0,
                        isYK: !1
                    }), setTimeout(function() {
                        a.setData({
                            subsucc: !1
                        }), wx.reLaunch({
                            url: "/pages/my/index"
                        });
                    }, 3e3));
                }
            });
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
}, e));